//
//  CCYHomeTitleButton.swift
//  03.微博
//
//  Created by 蔡承毅 on 16/9/24.
//  Copyright © 2016年 IOS. All rights reserved.
//

import UIKit

class CCYHomeTitleButton: UIButton {
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    init(name: String?){
        super.init(frame: CGRect())
        
        self.setImage(UIImage(named:"navigationbar_arrow_down"), for: .normal)
        self.setTitle(name, for: .normal)
        self.setTitleColor(UIColor.black, for: .normal)
        
        self.sizeToFit()
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        self.titleLabel?.frame.origin.x = 0
        
        self.imageView?.frame.origin.x = (self.titleLabel?.bounds.width ?? 0) + 3
    }
 
    
}
